# _*_ coding: UTF-8 _*_
# @Time     : 2021/11/3 10:44
# @Author   : Gong Yangyi
# @Site     : http://www.hzdledu.cn/
# @File     : w2s2_unittest验证结果.py
# @Software : PyCharm

from selenium import webdriver
import time
import unittest


class Test1(unittest.TestCase):
    def setUp(self) -> None:
        self.driver=webdriver.Chrome()
        self.driver.maximize_window()


    def test(self):
        self.driver.get('https://www.baidu.com/')
        text=self.driver.find_element_by_xpath('//*[@id="s-top-left"]/a[1]').text

        #asserEqual(预期值，实际值)：验证预期值和实际值是否相等，不等会报错，并且将用例标记为失败
        self.assertEqual('旧闻',text)

    def tearDown(self) -> None:
        self.driver.quit()
